package com.zzstm.educms.controller;

import com.zzstm.commonUtils.R;
import com.zzstm.educms.entity.CrmBanner;
import com.zzstm.educms.service.CrmBannerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@CrossOrigin
@RequestMapping("/educms/bannerFront")
public class BannerFrontController {

    @Autowired
    private CrmBannerService crmBannerService;

    //查询所有banner
    @Cacheable(key = "'selectIndexList'",value = "banner")
    @GetMapping("/getAllBanner")
    public R getAllBanner(){
        List<CrmBanner> list = crmBannerService.getAllBanner();
        return R.ok().data("list",list);
    }

}
